﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace SharedGenomics.Domain
{
    [DataContract]
    public class EntityInfo
    {
        public EntityInfo()
        {
        }

        public EntityInfo(int id, string name)
        {
            this.Id = id;
            this.Name = name;
        }

        //TODO: validate property setters...?
        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public string Name { get; set; }

        public override string ToString()
        {
            return this.Name;
        }

        public override bool Equals(object obj)
        {
            EntityInfo comp = obj as EntityInfo;
            return  comp != null &&
                    this.Id == comp.Id &&
                    String.Equals(this.Name, comp.Name);
        }

        public override int GetHashCode()
        {
            return this.Id.GetHashCode();
        }
    }
}
